//
//  PZLCateCameraTableViewCell.m
//  Various
//
//  Created by dllo on 16/3/30.
//  Copyright © 2016年 Harword. All rights reserved.
//

#import "PZLCateCameraTableViewCell.h"

@implementation PZLCateCameraTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatCell];
    }
    return self;
}




- (void)creatCell{
    
    self.imagePic = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, sWEIGHT*414, sHEIGHT * 200)];
    [self.contentView addSubview:self.imagePic];
    
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(15*sWEIGHT, 220*sHEIGHT, sWEIGHT * 380, 20*sHEIGHT)];
    [self.contentView addSubview:self.titleLabel];
    
    
    self.autherLabel = [[UILabel alloc]initWithFrame:CGRectMake(15*sWEIGHT, 240*sHEIGHT, 200*sWEIGHT, 15*sHEIGHT)];
    [self.contentView addSubview:self.autherLabel];
    
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 270*sHEIGHT, sWEIGHT*414, 10*sHEIGHT)];
    view.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.contentView addSubview:view];
    
    
    
    
}


- (void)setModel:(PZLCateCameraModel *)model{
    _model = model;
    
    self.titleLabel.text = model.title;
    self.titleLabel.font = [UIFont fontWithName:@"Arial" size:17*sWEIGHT];
    self.autherLabel.text = model.auther_name;
    self.autherLabel.font = [UIFont fontWithName:@"Arial" size:12*sWEIGHT];
    
    if (model.media.count >= 1) {
        [self.imagePic sd_setImageWithURL:[NSURL URLWithString:[model.media[1] objectForKey:@"url"]] placeholderImage:[UIImage imageNamed:@""]];
    }else{
        [self.imagePic sd_setImageWithURL:[NSURL URLWithString:[model.media[0] objectForKey:@"url"]] placeholderImage:[UIImage imageNamed:@""]];
    }
    
    
    
}



@end
